package models

import (
	"github.com/astaxie/beego/orm"
	"fmt"
)


//随行人员表
type Entourage struct {
	Id               int64
	EntryId          int64
	EntourageName    string
	EntourageTel     string
	EntourageSex     string
	Status           string

}
//建立模型
func init() {
	orm.RegisterModel(new(Entourage))
}

//获取活动列表
func GetEntouragelist(page int64, page_size int64, sort string) (entourage []orm.Params, count int64) {
	o := orm.NewOrm()
	Entourage := new(Entourage)
	qs := o.QueryTable(Entourage).Filter("Status", "0")
	var offset int64
	if page <= 1 {
		offset = 0
	} else {
		offset = (page - 1) * page_size
	}
	qs.Limit(page_size, offset).OrderBy(sort).Values(&entourage)
	count, _ = qs.Count()
	fmt.Println("entourage:", entourage)
	fmt.Println("count:", count)
	return entourage, count
}
func QueryStudents()([]*Entourage,error){
	o := orm.NewOrm()
	sds := make([]*Entourage,0)
	qs := o.QueryTable("Entourage")
	_,err := qs.All(&sds)
	return sds,err
}